package com.ai.dmc.index.web.util;

import javax.servlet.http.HttpSession;

import com.ai.dmc.index.common.bean.StaffSessBean;
import com.ai.dmc.index.common.InitParam;


/**
 * 
 * @Description : session工具类
 * 
 * @author : wucm
 * @date : 2015年4月6日 上午11:08:45
 * @version V1.0
 * 
 */
public class SessionInfoUtil {
	/**
	 * 设置StaffSessBean到session中
	 * 
	 * @param httpSession
	 * @param staffSessBean
	 */
	public static void setStaffSessBean(HttpSession httpSession,
			StaffSessBean staffSessBean) {
		httpSession.setAttribute("dtkl_session", staffSessBean);
	}

	/**
	 * 从Session中获取StaffSessBean
	 * 
	 * @param oSession
	 * @return Session中的StaffSessBean
	 */
	public static StaffSessBean getStaffSessBean(HttpSession httpSession) {
		StaffSessBean staffSessBean = (StaffSessBean) httpSession
				.getAttribute("dtkl_session");

//		if (null == staffSessBean && InitParam.DEPLOY_TYPE_DEVELOP
//				.equals(InitParam.DEPLOY_TYPE)) {
//			StaffSessBean paramBean = new StaffSessBean();
//			paramBean.setUserId(InitParam.DEVELOP_USER);
//
//			staffSessBean = ValidateInfoUtil.validateLogin(paramBean, true);
//			setStaffSessBean(httpSession, staffSessBean);
//		}

		return staffSessBean;
	}

	/**
	 * 从Session中删除StaffSessBean
	 * 
	 * 
	 * @param httpSession
	 */
	public static void removeStaffSessBean(HttpSession httpSession) {
		httpSession.removeAttribute("dtkl_session");
	}
}
